package com.sjy.ylxt.entity.domain;


import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;



@ApiModel(description="file_storage")
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Data
public class FileEntity  implements Serializable {
    @ApiModelProperty(value = "文件ID", example = "1", position = 1)
    @NotNull(message = "不能为null")
    private Long id;

    @ApiModelProperty(value = "文件名", example = "example.pdf", required = true, position = 2)
    @Size(max = 100,message = "文件名称最大长度要小于 100")
    @NotBlank(message = "文件名称不能为空")
    private String fileName;

    @ApiModelProperty(value = "文件类型", example = "application/pdf", position = 3)
    @NotBlank(message = "文件类型不能为空")
    private String fileType;

    @ApiModelProperty(value = "文件大小(字节)", example = "102400", position = 4)
    @NotBlank(message = "文件大小不能为空")
    private long fileSize;

//    @Lob
//    @Column(columnDefinition = "LONGBLOB")

   @ApiModelProperty(
           value = "文件二进制数据",
           notes = "Base64编码的字符串表示",
           dataType = "java.lang.String",
           example = "JVBERi0xLjQKJdP0zOEK...", // 简化的Base64示例
           position = 5
   )
   @NotBlank(message = "文件数据不能为空")
    private byte[] data;

   @TableField(exist = false)
   private String base64Data;


    @ApiModelProperty(value="上传时间")
    @NotNull(message = "上传时间不能为null")
    @JsonFormat(shape = JsonFormat.Shape.ANY,locale = "zh_CN",pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT")
    private Date uploadTime;
}
